POV-Ray : Newsgroups : povray.programming : UNIX POVRay does not exit with failure on error : Re: UNIX POVRay does not exit with failure on error Server Time
30 Jun 2024 12:13:33 EDT (-0400)
  Re: UNIX POVRay does not exit with failure on error  
From: Wolfgang Wieser
Date: 11 Aug 2004 18:04:28
Message: <411a97ec@news.povray.org>
Thorsten Froehlich wrote:
> Well, it certainly is given how the code is separated into a frontend and
> backend.  It also certainly is not trivial to understand.  In short the
> frontend is pure C++ while the backend has to suit C.  If you would check,
> you would find that povray_exit is only called with three different
> parameters (0, 1, 2) in four places.  Two signals a user about, one an
> error.  
>
I see. At least that's a clear and resonable decision. 

> So all you need to do if you desire a return value for a 
> command-line version (for a GUI version it does not matter) returned via
> main, you either exit directly (the default macro implementation), or, if
> you desire to perform proper cleanup (and displaying all other messages) you
> simply return -n via the longjmp and return that.  No adding of some magic
> values.
> 
Well, at least the "magic number 1" needs to be added since longjmp cannot 
be used to return the value 0. This is because 0 is used as setjmp return 
value to indicate direct return (i.e. not due to a call to longjmp).

-------<manual>-------
longjmp() cannot cause 0 to be returned.  If longjmp is invoked with a 
second argument of 0, 1 will be returned instead. 
-----------------------

Wolfgang


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.